/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import org.primefaces.event.FileUploadEvent;

/**
 *
 * @author amega
 */
@ManagedBean(name = "fileUploadController")
@RequestScoped
public class FileUploadController {
    public void processFileUpload(FileUploadEvent event) throws AbortProcessingException {
         System.out.println("Uploaded: " + event.getFile().getFileName());
         FacesMessage msg = new FacesMessage("Upload completed", event.getFile().getFileName() + " was successfully uploaded.");
         FacesContext.getCurrentInstance().addMessage(null, msg);
     }
}
